
import registro.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Ventanaprincipal.java
 *
 * Created on 01/10/2013, 03:05:39 PM
 */

/**
 *
 * @author Miguel
 */
import javax.swing.*;
import utilitarios.*;
import registro.*;
public class Ventanaprincipal extends javax.swing.JFrame {

    /** Creates new form Ventanaprincipal */
    data mostrar_datos;
    String set_look = "com.sun.java.swing.plaf.metal.MetalLookAndFeel";
    public Ventanaprincipal() {
        initComponents();
        mostrar_datos = new data();
        mostrar_datos.el_dato();//primero tengo que ejecutar este metodo para despues ejecutar el resto
        lbl_data.setText("Hoy es "+mostrar_datos.dia_semana+ " "+mostrar_datos.dia+" de "+mostrar_datos.mes+" del año "+mostrar_datos.anho);
        timer1.start();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        jPanel1 = new javax.swing.JPanel();
        btn_cliente = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        lbl_data = new javax.swing.JLabel();
        lbl_hora = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menu_registros = new javax.swing.JMenu();
        miten_clientes = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        miten_ciudades = new javax.swing.JMenuItem();
        miten_barrios = new javax.swing.JMenuItem();
        miten_direccion = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        miten_cargo = new javax.swing.JMenuItem();
        miten_funcionarios = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        miten_proveedores = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        menu_stock = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JPopupMenu.Separator();
        miten_salir = new javax.swing.JMenuItem();
        menu_consultas = new javax.swing.JMenu();
        menu_reportes = new javax.swing.JMenu();
        menu_utilitarios = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        menu_salir = new javax.swing.JMenu();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Prototipo Sistema de Control de Stock");

        jPanel1.setBackground(new java.awt.Color(204, 204, 204));

        btn_cliente.setIcon(new javax.swing.ImageIcon("C:\\systock\\systock\\imagen\\cliente1.png")); // NOI18N
        btn_cliente.setText("Cliente");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addComponent(btn_cliente)
                .addContainerGap(333, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btn_cliente)
                .addContainerGap(23, Short.MAX_VALUE))
        );

        jLabel1.setIcon(new javax.swing.ImageIcon("C:\\systock\\systock\\imagen\\politecnica.png")); // NOI18N

        lbl_data.setText("Fecha.:");

        lbl_hora.setText("Hora.:");

        menu_registros.setMnemonic('R');
        menu_registros.setText("Registros");

        miten_clientes.setIcon(new javax.swing.ImageIcon("C:\\systock\\systock\\imagen\\clientes.png")); // NOI18N
        miten_clientes.setMnemonic('C');
        miten_clientes.setText("Ciente");
        menu_registros.add(miten_clientes);
        menu_registros.add(jSeparator2);

        miten_ciudades.setMnemonic('i');
        miten_ciudades.setText("Ciudades");
        miten_ciudades.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_ciudadesActionPerformed(evt);
            }
        });
        menu_registros.add(miten_ciudades);

        miten_barrios.setMnemonic('B');
        miten_barrios.setText("Barrio");
        menu_registros.add(miten_barrios);

        miten_direccion.setMnemonic('D');
        miten_direccion.setText("Dirección");
        menu_registros.add(miten_direccion);
        menu_registros.add(jSeparator1);

        miten_cargo.setMnemonic('o');
        miten_cargo.setText("Cargo");
        menu_registros.add(miten_cargo);

        miten_funcionarios.setMnemonic('F');
        miten_funcionarios.setText("Funcionarios");
        menu_registros.add(miten_funcionarios);
        menu_registros.add(jSeparator3);

        miten_proveedores.setMnemonic('P');
        miten_proveedores.setText("Proveedores");
        menu_registros.add(miten_proveedores);
        menu_registros.add(jSeparator4);

        menu_stock.setMnemonic('k');
        menu_stock.setText("Stock");

        jMenuItem1.setMnemonic('I');
        jMenuItem1.setText("Implantación");
        menu_stock.add(jMenuItem1);

        jMenuItem2.setMnemonic('t');
        jMenuItem2.setText("Entrada de Stock");
        menu_stock.add(jMenuItem2);

        jMenuItem3.setMnemonic('d');
        jMenuItem3.setText("Salida");
        menu_stock.add(jMenuItem3);

        menu_registros.add(menu_stock);
        menu_registros.add(jSeparator5);

        miten_salir.setMnemonic('s');
        miten_salir.setText("Salir");
        menu_registros.add(miten_salir);

        jMenuBar1.add(menu_registros);

        menu_consultas.setMnemonic('n');
        menu_consultas.setText("Consultas");
        jMenuBar1.add(menu_consultas);

        menu_reportes.setMnemonic('r');
        menu_reportes.setText("Reportes");
        jMenuBar1.add(menu_reportes);

        menu_utilitarios.setMnemonic('U');
        menu_utilitarios.setText("Utilitarios");

        jMenuItem4.setText("Look And Feel - Windows");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuItem4);

        jMenuItem5.setText("Look And Feel -Liquid");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuItem5);

        jMenuItem6.setText("Look And Feel -Metal");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuItem6);

        jMenuItem7.setText("Look And Feel -Nimbus");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuItem7);

        jMenuBar1.add(menu_utilitarios);

        menu_salir.setMnemonic('S');
        menu_salir.setText("Salir");
        menu_salir.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menu_salirMouseClicked(evt);
            }
        });
        jMenuBar1.add(menu_salir);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 472, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lbl_data)
                    .addComponent(lbl_hora))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(65, 65, 65)
                .addComponent(lbl_data)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbl_hora)
                .addContainerGap(46, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-500)/2, (screenSize.height-400)/2, 500, 400);
    }// </editor-fold>//GEN-END:initComponents

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
        // TODO add your handling code here:
        mostrar_datos.leer_hora();
        lbl_hora.setText("Hora actual: "+mostrar_datos.hora);
    }//GEN-LAST:event_timer1OnTime

    private void menu_salirMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menu_salirMouseClicked
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_menu_salirMouseClicked

    private void miten_ciudadesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_ciudadesActionPerformed
        // Codigo para llamar a la ventana de Ciudad
        new registro_ciudad().show();
    }//GEN-LAST:event_miten_ciudadesActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // Codigo para asignar el look and feel de la ventana
        set_look = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
       lookandfeel();

    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
        set_look = "com.birosoft.liquid.LiquidLookAndFeel";
       lookandfeel();

    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        // TODO add your handling code here:
         set_look = "javax.swing.plaf.metal.MetalLookAndFeel";
         lookandfeel();
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        // TODO add your handling code here:
        set_look = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
       lookandfeel();
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Ventanaprincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_cliente;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JPopupMenu.Separator jSeparator5;
    private javax.swing.JLabel lbl_data;
    private javax.swing.JLabel lbl_hora;
    private javax.swing.JMenu menu_consultas;
    private javax.swing.JMenu menu_registros;
    private javax.swing.JMenu menu_reportes;
    private javax.swing.JMenu menu_salir;
    private javax.swing.JMenu menu_stock;
    private javax.swing.JMenu menu_utilitarios;
    private javax.swing.JMenuItem miten_barrios;
    private javax.swing.JMenuItem miten_cargo;
    private javax.swing.JMenuItem miten_ciudades;
    private javax.swing.JMenuItem miten_clientes;
    private javax.swing.JMenuItem miten_direccion;
    private javax.swing.JMenuItem miten_funcionarios;
    private javax.swing.JMenuItem miten_proveedores;
    private javax.swing.JMenuItem miten_salir;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables

    public void lookandfeel()
    {
     try
        {
        //La variable set look tiene que estar definida arriba como una variable String
        UIManager.setLookAndFeel(set_look);
        SwingUtilities.updateComponentTreeUI(this);
        }
        catch (Exception error)
         {
           JOptionPane.showMessageDialog(null, error);
         }

    }
}
